package Advanced.PageObject;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;



public class GoogleHomePage {
	
	  private WebDriver driver;
	  
	  public GoogleHomePage (WebDriver driver){
		  this.driver = driver;
		  if(!driver.getTitle().equals("Google")){throw new IllegalStateException("This is not the home page");}
	  }
	
	  public GoogleSearchPage doSearch(String mySearch) {
          
          driver.findElement(By.name("q")).sendKeys(mySearch);
          driver.findElement(By.id("gbqfb")).click();
          return new GoogleSearchPage(driver);
  }

}
